package ${package.infrastructure}.persistence.assembler;

import ${package.application}.api.response.${entity}QueryResponse;
import ${package.domain}.entity.${entity};
import ${package.infrastructure}.persistence.assembler.mapper.I${entity}POStructMapper;
import ${package.infrastructure}.persistence.po.${entity}PO;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * ${table.comment!}类型转换
 *
 * @author ${author}
 * @since ${date}
 */
@Component
public class ${entity}POAssembler {

    /**
     * ${table.comment!}持久化对象装配
     *
     * @param ${entity?uncap_first} ${table.comment!}实体
     * @return ${table.comment!}持久化对象
     */
    public ${entity}PO assembler(${entity} ${entity?uncap_first}) {
        return I${entity}POStructMapper.INSTANCE.fromEntity(${entity?uncap_first});
    }

    /**
     * ${table.comment!}持久化对象装配
     *
     * @param ${entity?uncap_first}List ${table.comment!}实体
     * @return ${table.comment!}持久化对象
     */
    public List<${entity}PO> assembler(List<${entity}> ${entity?uncap_first}List) {
        return I${entity}POStructMapper.INSTANCE.fromEntity(${entity?uncap_first}List);
    }

    /**
     * ${table.comment!}持久化对象 转 ${table.comment!}实体
     *
     * @param ${entity?uncap_first}PO ${table.comment!}持久化对象
     * @return ${table.comment!}实体
     */
    public ${entity} toEntity(${entity}PO ${entity?uncap_first}PO) {
        return I${entity}POStructMapper.INSTANCE.toEntity(${entity?uncap_first}PO);
    }

    /**
     * ${table.comment!}持久化对象列表  转 ${table.comment!}实体列表
     *
     * @param ${entity?uncap_first}POList ${table.comment!}持久化对象
     * @return ${table.comment!}实体
     */
    public List<${entity}> toEntity(List<${entity}PO> ${entity?uncap_first}POList) {
        return I${entity}POStructMapper.INSTANCE.toEntity(${entity?uncap_first}POList);
    }

    /**
     * ${table.comment!}持久化对象 转 ${table.comment!}查询响应数据传输对象
     *
     * @param ${entity?uncap_first}PO ${table.comment!}持久化对象
     * @return ${table.comment!}查询响应数据传输对象
     */
    public ${entity}QueryResponse toQueryResponse(${entity}PO ${entity?uncap_first}PO) {
        return I${entity}POStructMapper.INSTANCE.toQueryResponse(${entity?uncap_first}PO);
    }

    /**
     * ${table.comment!}持久化对象列表 转 ${table.comment!}查询响应数据传输对象列表
     *
     * @param ${entity?uncap_first}POList ${table.comment!}持久化对象列表
     * @return ${table.comment!}查询响应数据传输对象列表
     */
    public List<${entity}QueryResponse> toQueryResponse(List<${entity}PO> ${entity?uncap_first}POList) {
        return I${entity}POStructMapper.INSTANCE.toQueryResponse(${entity?uncap_first}POList);
    }
}
